/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.cesupa.cabcc.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 *
 * @author yuri
 */
@Entity
@NamedQueries({
    @NamedQuery(name="Reivindicacao.findById", query="SELECT r FROM Reivindicacao r WHERE r.id = :id"),
    @NamedQuery(name="Reivindicacao.findByUsuario", query="SELECT r FROM Reivindicacao r WHERE r.usuario = :usuario"),
    @NamedQuery(name="Reivindicacao.findAll", query="SELECT r FROM Reivindicacao r")
})
public class Reivindicacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataReivindicacao;
    @Lob
    private String texto;
    @OneToOne
    private Usuario usuario;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reivindicacao)) {
            return false;
        }
        Reivindicacao other = (Reivindicacao) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.cesupa.cabcc.entity.Reivindicacao[id=" + id + "]";
    }

    /**
     * @return the dataReivindicacao
     */
    public Date getDataReivindicacao() {
        return dataReivindicacao;
    }

    /**
     * @param dataReivindicacao the dataReivindicacao to set
     */
    public void setDataReivindicacao(Date dataReivindicacao) {
        this.dataReivindicacao = dataReivindicacao;
    }

    /**
     * @return the texto
     */
    public String getTexto() {
        return texto;
    }

    /**
     * @param texto the texto to set
     */
    public void setTexto(String texto) {
        this.texto = texto;
    }

    /**
     * @return the usuario
     */
    public Usuario getUsuario() {
        return usuario;
    }

    /**
     * @param usuario the usuario to set
     */
    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

}
